package com.ocgs.web.action.account;

import com.ocgs.base.core.web.action.BaseAction;
import com.ocgs.model.SystemAdmin;
import com.ocgs.service.impl.SystemAdminImpl;

import java.util.Date;
import java.util.List;


/**
 * @author Tang Bin Benoit
 * @version 1.0
 * @since 2012-05-14
 *
 */
public class AccountManageAction extends BaseAction{

    private static final long serialVersionUID = -2484651244734670052L;
    private SystemAdminImpl systemAdminService;
    private List adminList;
    private SystemAdmin admin;
       public List getAdminList() {
        return adminList;
    }

    public void setAdminList(List adminList) {
        this.adminList = adminList;
    }

    public SystemAdmin getAdmin() {
        return admin;
    }

    public void setAdmin(SystemAdmin admin) {
        this.admin = admin;
    }

    public void setSystemAdminService(SystemAdminImpl systemAdminService) {
        this.systemAdminService = systemAdminService;
    }

    public String loadInsertPage() {
      return "insertpage";
    }

    public String search(){
        paginatedList = systemAdminService.findAllSystemAdminForPagination(init(getRequest(),paginatedListImpl),admin);
        return "search";
    }

    public String loadInsertAdmin(){
        return "insertpage";
    }

    public String insert(){
        admin.setOncreate(new Date());
        systemAdminService.insert(admin);
        return "insert";
    }
}
